﻿<%@ Page Title="Add a Book" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="AddBook.aspx.vb" Inherits="BooksReviewApp.AddBook" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            font-size: xx-small;
            color: #993399;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div data-role="header">
    <h2>Add Book</h2>
  </div><!-- /header -->

        <table>
            <tr>
                <td>
                    Book Name
                </td>
                <td>
                    <asp:TextBox ID="tb_bookName" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="tb_bookName"
                        CssClass="field-validation-error" ErrorMessage="*"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Category
                </td>
                <td>
                    <asp:DropDownList ID="ddl_Genre" runat="server" AppendDataBoundItems="True" AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="Category" DataValueField="ID">
                        <asp:ListItem Value="0">Choose a Category</asp:ListItem>
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:BooksReviewDBConnectionString1 %>" SelectCommand="SELECT [ID], [Category] FROM [ComputingCategories]"></asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td>
                    Sub-Category</td>
                <td>
                    <asp:DropDownList ID="ddl_SubCategory" runat="server" DataSourceID="SqlDataSource2" DataTextField="SubCategory" DataValueField="ID">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:BooksReviewDBConnectionString1 %>" SelectCommand="SELECT [ID], [SubCategory] FROM [ComputingSubCategories] WHERE ([Category_FK] = @Category_FK)">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="ddl_Genre" Name="Category_FK" PropertyName="SelectedValue" Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td>
                    Language
                </td>
                <td>
                   
                    <asp:DropDownList ID="ddl_Language" runat="server" DataSourceID="SqlDataSource3" DataTextField="Language" DataValueField="ID" AppendDataBoundItems="True">
                    <asp:ListItem Value="0">Choose a Language</asp:ListItem>
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:BooksReviewDBConnectionString1 %>" SelectCommand="SELECT * FROM [CodingLanguages]"></asp:SqlDataSource>
                   
                </td>
            </tr>
            <tr>
                <td>
                    Description
                </td>
                <td>
                    <asp:TextBox ID="tb_Description" runat="server" TextMode="MultiLine"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="tb_Description"
                        CssClass="field-validation-error" ErrorMessage="*"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Review
                </td>
                <td>
                    <asp:TextBox ID="tb_Review" runat="server" TextMode="MultiLine"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="tb_Review"
                        CssClass="field-validation-error" ErrorMessage="*"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    User Rating
                </td>
                <td>
                    <asp:RadioButtonList ID="rbl_Rating" runat="server" RepeatDirection="Horizontal" BorderWidth="0px" CellPadding="10" CellSpacing="10" EnableTheming="True" Font-Size="Smaller" Height="10px" Width="70px">
                        <asp:ListItem Selected="True">1</asp:ListItem>
                        <asp:ListItem>2</asp:ListItem>
                        <asp:ListItem>3</asp:ListItem>
                        <asp:ListItem>4</asp:ListItem>
                        <asp:ListItem>5</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr>
                <td>
                    Picture
                    <br />
                    <span class="style1"><em>(Pref. Min. Res. 500x400)</em></span></td>
                <td>
                    <asp:FileUpload ID="f_Picture" runat="server" />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="f_Picture"
                        CssClass="field-validation-error" ErrorMessage="*"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="f_Picture"
                        CssClass="field-validation-error" ErrorMessage="Please Upload a valid Picture format"
                        ValidationExpression="^.*\.(jpg|JPG|JPEG|jpeg|gif|GIF|png|PNG|bmp|BMP)$"></asp:RegularExpressionValidator>
                </td>
            </tr>
        </table>
        <br />
        <br />
        <asp:Button ID="btn_AddBook" runat="server" Text="Add Book" CssClass="m-btn blue" />
        </asp:Content>
